#include <stdio.h>
double compute_average_word_length(const char *sentence);
int main(void)
{
    printf("Enter a sentence: ");
    char sentence[100 + 2];
    fgets(sentence, 100 + 2, stdin);
    printf("Average word length: %g\n", compute_average_word_length(sentence));
    return 0;
}
double compute_average_word_length(const char *sentence) {
    int count = 0, all_length = 0, word_length = 0;
    for (const char *p = sentence; *p; p++) {
        if (*p == ' ' || *p == '\n') {
            if (word_length) {
                count++;
                all_length += word_length;
                word_length = 0;
            }
        } else
            word_length++;
    }
    printf("%d %d\n", count, all_length);
    return (double)all_length / count;
}